package service.impl;


import POJO.AppInfo;
import mapper.AppInfoMapper;
import org.springframework.stereotype.Service;
import service.AppInfoService;

import javax.annotation.Resource;
import java.util.List;


@Service("appInfoService")
public class AppInfoServiceImpl implements AppInfoService {
    @Resource
    private AppInfoMapper appInfoMapper;

    @Override
    public int totalCountAppInfo(AppInfo appInfo) {
        return appInfoMapper.totalCountAppInfo(appInfo);
    }

    @Override
    public List<AppInfo> selAllOrByCondition(AppInfo appInfo, int currPageNo, int pageSize) {
        List<AppInfo> list=appInfoMapper.selAllOrByCondition(appInfo,currPageNo,pageSize);
        List<AppInfo> a=list;
        for(AppInfo as:list){
           as.getSoftwareName();
       }
        return list;
    }

    //根据ID删除基础信息表信息
    public int deleteAppInfo(int inId){
        //删除APP信息同时删除App版本信息
        int deleteAppVersion= appInfoMapper.deleteAppVersion(inId);
        int deleteAppInfo=0;

        deleteAppInfo=appInfoMapper.deleteAppInfo(inId);

        return deleteAppInfo;
    }
    //删除APP同时删除所有本APP版本信息

    //商品下架
    public int AppInfoLowerShelf(int inId){

        return appInfoMapper.AppInfoLowerShelf(inId);
    }
    //添加APP基础信息
    public int AddAppInfo(AppInfo appInfo){

        return appInfoMapper.AddAppInfo(appInfo);
    }
    //根据ID查询App信息
    public AppInfo appInfoListId(int noid){


        return appInfoMapper.appInfoListId(noid);
    }
    //修改APP基础信息
    public int UpdateAppInfo(AppInfo appInfo){
        return  appInfoMapper.UpdateAppInfo(appInfo);
    }
    //根据ID修改App状态
    public int UpdateAppInfostatus(int AppId,int status){

        return appInfoMapper.UpdateAppInfostatus(AppId,status);
    }
}
